/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package br.data.model;

import java.io.Serializable;
import java.util.Collection;
import java.util.Date;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author thiago
 */
@Entity
@Table(name = "fornecedores")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Fornecedores.findAll", query = "SELECT f FROM Fornecedores f"),
    @NamedQuery(name = "Fornecedores.findByCodigoforn", query = "SELECT f FROM Fornecedores f WHERE f.codigoforn = :codigoforn"),
    @NamedQuery(name = "Fornecedores.findByDatacadastro", query = "SELECT f FROM Fornecedores f WHERE f.datacadastro = :datacadastro"),
    @NamedQuery(name = "Fornecedores.findByResponsavel", query = "SELECT f FROM Fornecedores f WHERE f.responsavel = :responsavel"),
    @NamedQuery(name = "Fornecedores.findByRazaosocial", query = "SELECT f FROM Fornecedores f WHERE f.razaosocial = :razaosocial"),
    @NamedQuery(name = "Fornecedores.findByFantasia", query = "SELECT f FROM Fornecedores f WHERE f.fantasia = :fantasia"),
    @NamedQuery(name = "Fornecedores.findByCnpj", query = "SELECT f FROM Fornecedores f WHERE f.cnpj = :cnpj"),
    @NamedQuery(name = "Fornecedores.findByInscestadual", query = "SELECT f FROM Fornecedores f WHERE f.inscestadual = :inscestadual"),
    @NamedQuery(name = "Fornecedores.findByTelefone", query = "SELECT f FROM Fornecedores f WHERE f.telefone = :telefone"),
    @NamedQuery(name = "Fornecedores.findByRua", query = "SELECT f FROM Fornecedores f WHERE f.rua = :rua"),
    @NamedQuery(name = "Fornecedores.findByComplemento", query = "SELECT f FROM Fornecedores f WHERE f.complemento = :complemento"),
    @NamedQuery(name = "Fornecedores.findByBairro", query = "SELECT f FROM Fornecedores f WHERE f.bairro = :bairro"),
    @NamedQuery(name = "Fornecedores.findByLogradouro", query = "SELECT f FROM Fornecedores f WHERE f.logradouro = :logradouro"),
    @NamedQuery(name = "Fornecedores.findByCep", query = "SELECT f FROM Fornecedores f WHERE f.cep = :cep"),
    @NamedQuery(name = "Fornecedores.findByNumero", query = "SELECT f FROM Fornecedores f WHERE f.numero = :numero"),
    @NamedQuery(name = "Fornecedores.findByLogin", query = "SELECT f FROM Fornecedores f WHERE f.login = :login"),
    @NamedQuery(name = "Fornecedores.findBySenha", query = "SELECT f FROM Fornecedores f WHERE f.senha = :senha"),
    @NamedQuery(name = "Fornecedores.findByCpf", query = "SELECT f FROM Fornecedores f WHERE f.cpf = :cpf")})
public class Fornecedores implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @Column(name = "codigoforn")
    private Integer codigoforn;
    @Column(name = "datacadastro")
    @Temporal(TemporalType.DATE)
    private Date datacadastro;
    @Column(name = "responsavel")
    private String responsavel;
    @Column(name = "razaosocial")
    private String razaosocial;
    @Column(name = "fantasia")
    private String fantasia;
    @Column(name = "cnpj")
    private String cnpj;
    @Column(name = "inscestadual")
    private String inscestadual;
    @Column(name = "telefone")
    private String telefone;
    @Column(name = "rua")
    private String rua;
    @Column(name = "complemento")
    private String complemento;
    @Column(name = "bairro")
    private String bairro;
    @Column(name = "logradouro")
    private String logradouro;
    @Column(name = "cep")
    private String cep;
    @Column(name = "numero")
    private Integer numero;
    @Column(name = "login")
    private String login;
    @Column(name = "senha")
    private String senha;
    @Column(name = "cpf")
    private String cpf;
    @JoinColumn(name = "codigoest", referencedColumnName = "codigoest")
    @ManyToOne(optional = false)
    private Estados codigoest;
    @JoinColumn(name = "codigocid", referencedColumnName = "codigocid")
    @ManyToOne(optional = false)
    private Cidades codigocid;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "fornecedores")
    private Collection<Listaprecos> listaprecosCollection;

    public Fornecedores() {
    }

    public Fornecedores(Integer codigoforn) {
        this.codigoforn = codigoforn;
    }

    public Integer getCodigoforn() {
        return codigoforn;
    }

    public void setCodigoforn(Integer codigoforn) {
        this.codigoforn = codigoforn;
    }

    public Date getDatacadastro() {
        return datacadastro;
    }

    public void setDatacadastro(Date datacadastro) {
        this.datacadastro = datacadastro;
    }

    public String getResponsavel() {
        return responsavel;
    }

    public void setResponsavel(String responsavel) {
        this.responsavel = responsavel;
    }

    public String getRazaosocial() {
        return razaosocial;
    }

    public void setRazaosocial(String razaosocial) {
        this.razaosocial = razaosocial;
    }

    public String getFantasia() {
        return fantasia;
    }

    public void setFantasia(String fantasia) {
        this.fantasia = fantasia;
    }

    public String getCnpj() {
        return cnpj;
    }

    public void setCnpj(String cnpj) {
        this.cnpj = cnpj;
    }

    public String getInscestadual() {
        return inscestadual;
    }

    public void setInscestadual(String inscestadual) {
        this.inscestadual = inscestadual;
    }

    public String getTelefone() {
        return telefone;
    }

    public void setTelefone(String telefone) {
        this.telefone = telefone;
    }

    public String getRua() {
        return rua;
    }

    public void setRua(String rua) {
        this.rua = rua;
    }

    public String getComplemento() {
        return complemento;
    }

    public void setComplemento(String complemento) {
        this.complemento = complemento;
    }

    public String getBairro() {
        return bairro;
    }

    public void setBairro(String bairro) {
        this.bairro = bairro;
    }

    public String getLogradouro() {
        return logradouro;
    }

    public void setLogradouro(String logradouro) {
        this.logradouro = logradouro;
    }

    public String getCep() {
        return cep;
    }

    public void setCep(String cep) {
        this.cep = cep;
    }

    public Integer getNumero() {
        return numero;
    }

    public void setNumero(Integer numero) {
        this.numero = numero;
    }

    public String getLogin() {
        return login;
    }

    public void setLogin(String login) {
        this.login = login;
    }

    public String getSenha() {
        return senha;
    }

    public void setSenha(String senha) {
        this.senha = senha;
    }

    public String getCpf() {
        return cpf;
    }

    public void setCpf(String cpf) {
        this.cpf = cpf;
    }

    public Estados getCodigoest() {
        return codigoest;
    }

    public void setCodigoest(Estados codigoest) {
        this.codigoest = codigoest;
    }

    public Cidades getCodigocid() {
        return codigocid;
    }

    public void setCodigocid(Cidades codigocid) {
        this.codigocid = codigocid;
    }

    @XmlTransient
    public Collection<Listaprecos> getListaprecosCollection() {
        return listaprecosCollection;
    }

    public void setListaprecosCollection(Collection<Listaprecos> listaprecosCollection) {
        this.listaprecosCollection = listaprecosCollection;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (codigoforn != null ? codigoforn.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Fornecedores)) {
            return false;
        }
        Fornecedores other = (Fornecedores) object;
        if ((this.codigoforn == null && other.codigoforn != null) || (this.codigoforn != null && !this.codigoforn.equals(other.codigoforn))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "br.data.model.Fornecedores[ codigoforn=" + codigoforn + " ]";
    }
    
}
